#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDialog>
#include "dialog.h"
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
    Dialog* dialog=new Dialog(this);//自己创建的类,要想指定父元素，需要在构造函数中改一下
    dialog->resize(300,400);
    dialog->setAttribute(Qt::WA_DeleteOnClose);
    dialog->show();
}

